//全排列的价值
#include <bits/stdc++.h>
using namespace std;

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	int mod = 998244353;
	long long INV2 = (998244353+1)/2;
	long long fact = 1;
	long long ans = 0;
	long long tmp = 0;
	long long n = 0;
	cin >> n;
	for(long long i = 1; i <= n;i++)
	{
		tmp = (i%mod)*((i-1)%mod)%mod;
		tmp = (tmp*(INV2))%mod;
		ans = ((ans%mod)*(i%mod)%mod + (tmp * fact)%mod)%mod;
		fact = fact * (i%mod) % mod;
	}
	cout << ans;
	
	return 0;
}
